<template>
   <div class="top">
      <NavBar>
      <template v-slot:default>商品详情</template>
      <template v-slot:right>...</template>
    </NavBar>
    <el-tabs :tab-position="tabPosition">
      <el-tab-pane
        v-for="(item, index) in categoryRelationList"
        :key="index"
        :label="item.name"
      >
        <div v-for="(item, index) in item.goods" :key="index" class="cs">
         
            <img v-bind:src="API.BASE_SERVER_URL + item.imgPath" class="img" />
            <h5>{{ item.name }}</h5>
            <h4 class="h4">￥{{ item.price }}.00</h4>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
   
</template>

<script>
import { reactive, toRefs } from 'vue'
import {useRoute} from 'vue-router'
import NavBar from '../../components/mobile/NavBar.vue'

export default {
  data() {
    return {
      categoryRelationList: [],
      tabPosition: "left",
    };
  },
    components: {
      NavBar
    },
    setup () {
        const route = useRoute()
        const state = reactive({
            count: 0,
        })
    
        return {
            ...toRefs(state),
        }
    },
    created: function () {
    this.$get(this.API.BASE_SERVER_URL + "/api/v1/getGoodList").then(
      (res) => {
        if (res.errorCode == 0) {
          this.categoryRelationList = res.data;
        }
      }
    );
  },
}
</script>

<style lang="scss" scoped>
.top {
  margin-top: 60px;
}
.img {
  width: 100px;
  height: 100px;
}

.cs {
  width: 105px;
  height: 160px;
  float: left;
  margin-left: 2px;
  font-size: 5px;
  font-family: Arial, Helvetica, sans-serif;
}
.h4 {
  color: coral;
  font-size: 15px;
}
</style>